﻿///***************************************************************
/// 시  스  템 : Updms.Cfg.Dac
/// 단위시스템 : CFG
/// 계      층 : Data Access Layer
/// 프로그램명 : Cfg_Dac_UPDMS_CFG_SQL_EXECUTE
/// 파  일  명 : Cfg_Dac_UPDMS_CFG_SQL_EXECUTE.cs
/// 설      명 : SQL실행기
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-08-11 송시명   최초 작성
///***************************************************************
using System.Data;
using System.EnterpriseServices;
using System.Runtime.InteropServices;


namespace Updms.Cfg.Dac
{
	[ComVisible(true)]
	[Transaction(TransactionOption.Supported)]
	[JustInTimeActivation(true)]
	public class Cfg_Dac_UPDMS_CFG_SQL_EXECUTE : Base.AppFramework.DacBase
	{
		public Cfg_Dac_UPDMS_CFG_SQL_EXECUTE()
		{
		}

		#region NT [GetUpdmsTableInfo]

		[AutoComplete]
		public DataSet GetUpdmsTableInfo(string ls_database)
		{
			string strSql = "USE UPDMS EXEC sp_tables '" + ls_database + "_%'";

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_CFG_SQL_EXECUTE", ds, null, CommandType.Text);
		}
		
		#endregion

		#region NT [SelectProcess]
		
		[AutoComplete]
		public DataSet SelectProcess(string ls_sql_query)
		{
			string strSql = ls_sql_query;			

			DataSet ds = new DataSet();
			return _agent.Fill(strSql, "UPDMS_CFG_SQL_EXECUTE", ds, null, CommandType.Text);
		}
		
		#endregion
		

		#region RT [Insert]
		/*
		[AutoComplete]
		public int Insert(DataPack lo_dp)
		{
			string strSql = "usp_[TABLENAME]_Insert";

			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		*/
		#endregion

		#region RT [Update]
		/*
		[AutoComplete]
		public int Update(DataPack lo_dp)
		{
			string strSql = "usp_[TABLENAME]_Update";

			//데이터팩 로깅
			string ls_src = "Com_Dac_UPDMS_COM_CD.Update." + strSql;

			SMEventLog.WriteDataLog(ls_src, lo_dp);
			
			SqlParameter[] paramArray = lo_dp.ToSqlParameters();
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		*/
		#endregion

		#region RT [Delete]
		/*
		[AutoComplete]
		public int Delete(string ls_seq)
		{
			string strSql = "usp_[TABLENAME]_Delete";

			SqlParameter[] paramArray =
			{
				new SqlParameter("Seq", ls_seq)
			};
			
			return _agent.ExecuteNonQuery(strSql, paramArray, CommandType.StoredProcedure);
		}
		*/
		#endregion
	}
}
